<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>mysql | ZJNULL</title><meta name="author" content="花开一百年"><meta name="copyright" content="花开一百年"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="MySQL 课堂笔记1. 连接 MySQL 数据库使用 root 用户连接 MySQL： 1mysql -u root -p 输入密码后，即可进入 MySQL 命令行模式。  机房的用户名账号密码都为root  2. 查看数据库1SHOW DATABASES;  3. 创建数据库1CREATE DATABASE mydb;  4. 使用数据库1USE mydb;  5. 创建表12345CREAT">
<meta property="og:type" content="article">
<meta property="og:title" content="mysql">
<meta property="og:url" content="https://zjnull.cn/mysql/index.html">
<meta property="og:site_name" content="ZJNULL">
<meta property="og:description" content="MySQL 课堂笔记1. 连接 MySQL 数据库使用 root 用户连接 MySQL： 1mysql -u root -p 输入密码后，即可进入 MySQL 命令行模式。  机房的用户名账号密码都为root  2. 查看数据库1SHOW DATABASES;  3. 创建数据库1CREATE DATABASE mydb;  4. 使用数据库1USE mydb;  5. 创建表12345CREAT">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://zjnull.cn/img/3.png">
<meta property="article:published_time" content="2025-02-21T12:48:42.000Z">
<meta property="article:modified_time" content="2025-02-21T12:49:33.001Z">
<meta property="article:author" content="花开一百年">
<meta property="article:tag" content="还不知道什么是这个,keyword在这里">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zjnull.cn/img/3.png"><script type="application/ld+json">{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "headline": "mysql",
  "url": "https://zjnull.cn/mysql/",
  "image": "https://zjnull.cn/img/3.png",
  "datePublished": "2025-02-21T12:48:42.000Z",
  "dateModified": "2025-02-21T12:49:33.001Z",
  "author": [
    {
      "@type": "Person",
      "name": "花开一百年",
      "url": "https://zjnull.cn/"
    }
  ]
}</script><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://zjnull.cn/mysql/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><script>
    (() => {
      
    const saveToLocal = {
      set: (key, value, ttl) => {
        if (!ttl) return
        const expiry = Date.now() + ttl * 86400000
        localStorage.setItem(key, JSON.stringify({ value, expiry }))
      },
      get: key => {
        const itemStr = localStorage.getItem(key)
        if (!itemStr) return undefined
        const { value, expiry } = JSON.parse(itemStr)
        if (Date.now() > expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return value
      }
    }

    window.btf = {
      saveToLocal,
      getScript: (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
        script.onload = script.onreadystatechange = () => {
          if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
        }
        script.onerror = reject
        document.head.appendChild(script)
      }),
      getCSS: (url, id) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onload = link.onreadystatechange = () => {
          if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
        }
        link.onerror = reject
        document.head.appendChild(link)
      }),
      addGlobalFn: (key, fn, name = false, parent = window) => {
        if (!false && key.startsWith('pjax')) return
        const globalFn = parent.globalFn || {}
        globalFn[key] = globalFn[key] || {}
        globalFn[key][name || Object.keys(globalFn[key]).length] = fn
        parent.globalFn = globalFn
      }
    }
  
      
      const activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      const activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }

      btf.activateDarkMode = activateDarkMode
      btf.activateLightMode = activateLightMode

      const theme = saveToLocal.get('theme')
    
          theme === 'dark' ? activateDarkMode() : theme === 'light' ? activateLightMode() : null
        
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
      }
    
      
    const detectApple = () => {
      if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
  
    })()
  </script><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":true},
  copy: {
    success: '复制成功',
    error: '复制失败',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'null',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyloadPlugin: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'mysql',
  isHighlightShrink: false,
  isToc: true,
  pageType: 'post'
}</script><meta name="generator" content="Hexo 7.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img text-center"><img src="/img/3.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data text-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">9</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">2</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首頁</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 時間軸</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 標籤</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分類</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://c6.y.qq.com/base/fcgi-bin/u?__=RcB7yFqBThqr"><i class="fa-fw fas fa-music"></i><span> 音樂</span></a></div><div class="menus_item"><a class="site-page" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 電影</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 關於</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(/img/2.jpg);"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><img class="site-icon" src="/img/4.png" alt="Logo"><span class="site-name">ZJNULL</span></a><a class="nav-page-title" href="/"><span class="site-name">mysql</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首頁</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 時間軸</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 標籤</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分類</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://c6.y.qq.com/base/fcgi-bin/u?__=RcB7yFqBThqr"><i class="fa-fw fas fa-music"></i><span> 音樂</span></a></div><div class="menus_item"><a class="site-page" href="/Gallery/"><i class="fa-fw fas fa-images"></i><span> 照片</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 電影</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 關於</span></a></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">mysql</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2025-02-21T12:48:42.000Z" title="发表于 2025-02-21 20:48:42">2025-02-21</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-02-21T12:49:33.001Z" title="更新于 2025-02-21 20:49:33">2025-02-21</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="container post-content" id="article-container"><h1 id="MySQL-课堂笔记"><a href="#MySQL-课堂笔记" class="headerlink" title="MySQL 课堂笔记"></a>MySQL 课堂笔记</h1><h2 id="1-连接-MySQL-数据库"><a href="#1-连接-MySQL-数据库" class="headerlink" title="1. 连接 MySQL 数据库"></a>1. 连接 MySQL 数据库</h2><p>使用 root 用户连接 MySQL：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql -u root -p</span><br></pre></td></tr></table></figure>
<p>输入密码后，即可进入 MySQL 命令行模式。</p>
<blockquote>
<p>机房的用户名账号密码都为root</p>
</blockquote>
<h2 id="2-查看数据库"><a href="#2-查看数据库" class="headerlink" title="2. 查看数据库"></a>2. 查看数据库</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SHOW</span> DATABASES;</span><br></pre></td></tr></table></figure>

<h2 id="3-创建数据库"><a href="#3-创建数据库" class="headerlink" title="3. 创建数据库"></a>3. 创建数据库</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">CREATE</span> DATABASE mydb;</span><br></pre></td></tr></table></figure>

<h2 id="4-使用数据库"><a href="#4-使用数据库" class="headerlink" title="4. 使用数据库"></a>4. 使用数据库</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">USE mydb;</span><br></pre></td></tr></table></figure>

<h2 id="5-创建表"><a href="#5-创建表" class="headerlink" title="5. 创建表"></a>5. 创建表</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">CREATE TABLE</span> users (</span><br><span class="line">    id <span class="type">INT</span> AUTO_INCREMENT <span class="keyword">PRIMARY KEY</span>,</span><br><span class="line">    name <span class="type">VARCHAR</span>(<span class="number">50</span>) <span class="keyword">NOT NULL</span>,</span><br><span class="line">    age <span class="type">INT</span> <span class="keyword">NOT NULL</span></span><br><span class="line">);</span><br></pre></td></tr></table></figure>

<h2 id="6-查看表"><a href="#6-查看表" class="headerlink" title="6. 查看表"></a>6. 查看表</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SHOW</span> TABLES;</span><br></pre></td></tr></table></figure>

<h2 id="7-查看表结构"><a href="#7-查看表结构" class="headerlink" title="7. 查看表结构"></a>7. 查看表结构</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DESC</span> users;</span><br></pre></td></tr></table></figure>

<h2 id="8-插入数据"><a href="#8-插入数据" class="headerlink" title="8. 插入数据"></a>8. 插入数据</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">INSERT INTO</span> users (name, age) <span class="keyword">VALUES</span> (<span class="string">&#x27;Alice&#x27;</span>, <span class="number">25</span>), (<span class="string">&#x27;Bob&#x27;</span>, <span class="number">30</span>);</span><br></pre></td></tr></table></figure>

<h2 id="9-查询数据"><a href="#9-查询数据" class="headerlink" title="9. 查询数据"></a>9. 查询数据</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="operator">*</span> <span class="keyword">FROM</span> users;</span><br></pre></td></tr></table></figure>

<h2 id="10-更新数据"><a href="#10-更新数据" class="headerlink" title="10. 更新数据"></a>10. 更新数据</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">UPDATE</span> users <span class="keyword">SET</span> age <span class="operator">=</span> <span class="number">26</span> <span class="keyword">WHERE</span> name <span class="operator">=</span> <span class="string">&#x27;Alice&#x27;</span>;</span><br></pre></td></tr></table></figure>

<h2 id="11-删除数据"><a href="#11-删除数据" class="headerlink" title="11. 删除数据"></a>11. 删除数据</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DELETE</span> <span class="keyword">FROM</span> users <span class="keyword">WHERE</span> name <span class="operator">=</span> <span class="string">&#x27;Bob&#x27;</span>;</span><br></pre></td></tr></table></figure>

<h2 id="12-删除表"><a href="#12-删除表" class="headerlink" title="12. 删除表"></a>12. 删除表</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DROP</span> <span class="keyword">TABLE</span> users;</span><br></pre></td></tr></table></figure>

<h2 id="13-删除数据库"><a href="#13-删除数据库" class="headerlink" title="13. 删除数据库"></a>13. 删除数据库</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DROP</span> DATABASE mydb;</span><br></pre></td></tr></table></figure>

<h2 id="14-退出-MySQL"><a href="#14-退出-MySQL" class="headerlink" title="14. 退出 MySQL"></a>14. 退出 MySQL</h2><pre><code class="language-sql">EXIT;
</code></pre>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://zjnull.cn">花开一百年</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://zjnull.cn/mysql/">https://zjnull.cn/mysql/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://zjnull.cn" target="_blank">ZJNULL</a>！</span></div></div><div class="tag_share"><div class="post-share"><div class="social-share" data-image="/img/3.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><a class="pagination-related" href="/tips/" title="ZJNULL 项目说明"><div class="cover" style="background: var(--default-bg-color)"></div><div class="info"><div class="info-1"><div class="info-item-1">上一篇</div><div class="info-item-2">ZJNULL 项目说明</div></div><div class="info-2"><div class="info-item-1">Hexo 项目说明目前，zjnull本项目在 GitHub 仓库有两个分支：  main 分支：Hexo 自动生成的静态网页文件（hexo clean &amp;&amp; hexo g &amp;&amp; hexo d）   source 分支：在 VS Code 里手动推送的全部 Hexo 源码  关于 HexoHexo 是一个基于 Node.js 高效的web服务器框架，可以快速生成静态网页。 Hexo 使用 Markdown（或其他语言）来写文章，并在渲染时将其转换为 HTML 文件。 Hexo 支持丰富的插件，可以实现各种功能，如评论、搜索、统计、分类、标签、分页等。 Hexo 支持自定义页面，可以搭建个人博客或企业网站。 Hexo 支持本地预览，可以实时看到修改后的效果。 Hexo 支持部署到 GitHub、GitLab、Coding 等平台。 Hexo 部署分支修改Hexo 的部署分支通常是在 _config.yml 配置文件中的 deploy 部分进行设置。例如： 12345# _config.ymldeploy:  type: git  repo:...</div></div></div></a><a class="pagination-related" href="/IIS/" title="使用 IIS 搭建本地 Web 服务器"><div class="cover" style="background: var(--default-bg-color)"></div><div class="info text-right"><div class="info-1"><div class="info-item-1">下一篇</div><div class="info-item-2">使用 IIS 搭建本地 Web 服务器</div></div><div class="info-2"><div class="info-item-1">使用 IIS 搭建本地 Web 服务器1. 搭建 IIS1.1 启用 IIS 服务 打开 控制面板，进入 程序 点击 启用或关闭 Windows 功能 在弹出的窗口中，勾选 Internet 信息服务 (IIS) 相关服务 点击 确定，等待系统安装并配置 IIS  1.2 进入 IIS 管理器 在 开始菜单 或 运行 (Win + R) 输入 inetmgr 并回车，打开 IIS 管理器。 在左侧连接面板中，展开本地计算机的 IIS 站点管理。  1.3 添加网站（也可以直接使用Default Web Site) 在 IIS 管理器 中，右键 网站，选择 添加网站。  在弹出的窗口中，配置以下参数：  网站名称：yourname 物理路径：选择本地存放网站文件的根目录。 IP 地址： 可选择 全部未分配。 也可以选择本机网卡地址（推荐），这样同一局域网下的设备可通过该地址访问。   端口：建议使用默认 80 端口，避免用户访问时手动输入端口号。 主机名： 可以设置为自定义的访问网址。 若端口不是 80，则访问时需使用 网址:端口号 形式。     点击...</div></div></div></a></nav><hr class="custom-hr"/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="giscus-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info text-center"><div class="avatar-img"><img src="/img/3.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info-name">花开一百年</div><div class="author-info-description"></div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">9</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">2</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Brian510000"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons"><a class="social-icon" href="https://github.com/Brian510000" target="_blank" title="Github"><i class="fab fa-brands fa-git-alt" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:croydefilippomz8544@gmail.com" target="_blank" title="Email"><i class="fas fa-brands fa-google" style="color: #4285F4;"></i></a><a class="social-icon" href="/img/7.jpg" target="_blank" title="WeChat"><i class="fab fa-brands fa-weixin" style="color: #1AAD19;"></i></a><a class="social-icon" href="tencent://message/?uin=3193429949&amp;Site=&amp;Menu=yes" target="_blank" title="QQ"><i class="fab fa-brands fa-qq" style="color: #12B7F5;"></i></a><a class="social-icon" href="https://space.bilibili.com/309421020" target="_blank" title="Bilibili"><i class="fab fa-brands fa-bilibili" style="color: #FB7299;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">还在维护中,导航栏指针未定义,界面UI待优化</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#MySQL-%E8%AF%BE%E5%A0%82%E7%AC%94%E8%AE%B0"><span class="toc-number">1.</span> <span class="toc-text">MySQL 课堂笔记</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E8%BF%9E%E6%8E%A5-MySQL-%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.1.</span> <span class="toc-text">1. 连接 MySQL 数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E6%9F%A5%E7%9C%8B%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.2.</span> <span class="toc-text">2. 查看数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%88%9B%E5%BB%BA%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.3.</span> <span class="toc-text">3. 创建数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E4%BD%BF%E7%94%A8%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.4.</span> <span class="toc-text">4. 使用数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E5%88%9B%E5%BB%BA%E8%A1%A8"><span class="toc-number">1.5.</span> <span class="toc-text">5. 创建表</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-%E6%9F%A5%E7%9C%8B%E8%A1%A8"><span class="toc-number">1.6.</span> <span class="toc-text">6. 查看表</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-%E6%9F%A5%E7%9C%8B%E8%A1%A8%E7%BB%93%E6%9E%84"><span class="toc-number">1.7.</span> <span class="toc-text">7. 查看表结构</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-%E6%8F%92%E5%85%A5%E6%95%B0%E6%8D%AE"><span class="toc-number">1.8.</span> <span class="toc-text">8. 插入数据</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-%E6%9F%A5%E8%AF%A2%E6%95%B0%E6%8D%AE"><span class="toc-number">1.9.</span> <span class="toc-text">9. 查询数据</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#10-%E6%9B%B4%E6%96%B0%E6%95%B0%E6%8D%AE"><span class="toc-number">1.10.</span> <span class="toc-text">10. 更新数据</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#11-%E5%88%A0%E9%99%A4%E6%95%B0%E6%8D%AE"><span class="toc-number">1.11.</span> <span class="toc-text">11. 删除数据</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#12-%E5%88%A0%E9%99%A4%E8%A1%A8"><span class="toc-number">1.12.</span> <span class="toc-text">12. 删除表</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#13-%E5%88%A0%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.13.</span> <span class="toc-text">13. 删除数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#14-%E9%80%80%E5%87%BA-MySQL"><span class="toc-number">1.14.</span> <span class="toc-text">14. 退出 MySQL</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/IIS/" title="使用 IIS 搭建本地 Web 服务器">使用 IIS 搭建本地 Web 服务器</a><time datetime="2025-02-21T21:09:06.000Z" title="发表于 2025-02-22 05:09:06">2025-02-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/mysql/" title="mysql">mysql</a><time datetime="2025-02-21T12:48:42.000Z" title="发表于 2025-02-21 20:48:42">2025-02-21</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/tips/" title="ZJNULL 项目说明">ZJNULL 项目说明</a><time datetime="2025-02-19T06:50:29.000Z" title="发表于 2025-02-19 14:50:29">2025-02-19</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/clash/" title="Clash 网络代理">Clash 网络代理</a><time datetime="2025-02-19T05:05:33.000Z" title="发表于 2025-02-19 13:05:33">2025-02-19</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/Audio-jumper/" title="Audio jumper">Audio jumper</a><time datetime="2025-02-18T13:06:33.000Z" title="发表于 2025-02-18 21:06:33">2025-02-18</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url(/img/2.jpg);"><div id="footer-wrap"><div class="copyright">&copy;2025 By 花开一百年</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://icp.gov.moe/?keyword=20250918" target="_blank">萌ICP备20250918号</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="前往评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><div class="js-pjax"><script>(() => {
  const isShuoshuo = GLOBAL_CONFIG_SITE.pageType === 'shuoshuo'
  const option = null

  const getGiscusTheme = theme => theme === 'dark' ? 'dark' : 'light'

  const createScriptElement = config => {
    const ele = document.createElement('script')
    Object.entries(config).forEach(([key, value]) => {
      ele.setAttribute(key, value)
    })
    return ele
  }

  const loadGiscus = (el = document, key) => {
    const mappingConfig = isShuoshuo
      ? { 'data-mapping': 'specific', 'data-term': key }
      : { 'data-mapping': (option && option['data-mapping']) || 'pathname' }

    const giscusConfig = {
      src: 'https://giscus.app/client.js',
      'data-repo': 'Brian510000/comments',
      'data-repo-id': 'R_kgDON4YPQQ',
      'data-category-id': 'DIC_kwDON4YPQc4Cm5dh',
      'data-theme': getGiscusTheme(document.documentElement.getAttribute('data-theme')),
      'data-reactions-enabled': '1',
      crossorigin: 'anonymous',
      async: true,
      ...option,
      ...mappingConfig
    }

    const scriptElement = createScriptElement(giscusConfig)

    el.querySelector('#giscus-wrap').appendChild(scriptElement)

    if (isShuoshuo) {
      window.shuoshuoComment.destroyGiscus = () => {
        if (el.children.length) {
          el.innerHTML = ''
          el.classList.add('no-comment')
        }
      }
    }
  }

  const changeGiscusTheme = theme => {
    const iframe = document.querySelector('#giscus-wrap iframe')
    if (iframe) {
      const message = {
        giscus: {
          setConfig: {
            theme: getGiscusTheme(theme)
          }
        }
      }
      iframe.contentWindow.postMessage(message, 'https://giscus.app')
    }
  }

  btf.addGlobalFn('themeChange', changeGiscusTheme, 'giscus')

  if (isShuoshuo) {
    'Giscus' === 'Giscus'
      ? window.shuoshuoComment = { loadComment: loadGiscus }
      : window.loadOtherComment = loadGiscus
    return
  }

  if ('Giscus' === 'Giscus' || !false) {
    if (false) btf.loadComment(document.getElementById('giscus-wrap'), loadGiscus)
    else loadGiscus()
  } else {
    window.loadOtherComment = loadGiscus
  }
})()</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>